package com.mq.rabbitmq.consume;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 定义消费者类
 * 接收生产者传递过来的消息
 */
@Component
public class HelloConsume {
    /**
     * 接收消息
     */
    @RabbitListener(queuesToDeclare = @Queue(name = "testQueue"))
    public void receive(String msg){
        System.out.println("消费者接收到的消息是："+msg);
    }
}
